﻿using System;
using System.Data;
using System.Data.Common;
using Hxj.Data;
using Hxj.Data.Common;

namespace Utility.Model
{

    /// <summary>
    /// 实体类Sys_Group 。(属性说明自动提取数据库字段的描述信息)
    /// </summary>
    [Serializable]
    public class Sys_Group : Entity
    {
        public Sys_Group()
            : base("Sys_Group")
        {
            _GroupID = Guid.NewGuid().ToString();
            _CreateDate = DateTime.Now;
            _IsDelete = false;
        }

        #region Model
        private string _GroupID;
        private string _GroupName;
        private string _GroupDes;
        private bool? _IsDelete;
        private string _CreateUser;
        private DateTime? _CreateDate;
        /// <summary>
        /// 
        /// </summary>
        public string GroupID
        {
            get { return _GroupID; }
            set
            {
                this.OnPropertyValueChange(_.GroupID, _GroupID, value);
                this._GroupID = value;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public string GroupName
        {
            get { return _GroupName; }
            set
            {
                this.OnPropertyValueChange(_.GroupName, _GroupName, value);
                this._GroupName = value;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public string GroupDes
        {
            get { return _GroupDes; }
            set
            {
                this.OnPropertyValueChange(_.GroupDes, _GroupDes, value);
                this._GroupDes = value;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public bool? IsDelete
        {
            get { return _IsDelete; }
            set
            {
                this.OnPropertyValueChange(_.IsDelete, _IsDelete, value);
                this._IsDelete = value;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public string CreateUser
        {
            get { return _CreateUser; }
            set
            {
                this.OnPropertyValueChange(_.CreateUser, _CreateUser, value);
                this._CreateUser = value;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? CreateDate
        {
            get { return _CreateDate; }
            set
            {
                this.OnPropertyValueChange(_.CreateDate, _CreateDate, value);
                this._CreateDate = value;
            }
        }
        #endregion

        #region Method
        /// <summary>
        /// 获取实体中的主键列
        /// </summary>
        public override Field[] GetPrimaryKeyFields()
        {
            return new Field[] {
				_.GroupID};
        }
        /// <summary>
        /// 获取列信息
        /// </summary>
        public override Field[] GetFields()
        {
            return new Field[] {
				_.GroupID,
				_.GroupName,
				_.GroupDes,
				_.IsDelete,
				_.CreateUser,
				_.CreateDate};
        }
        /// <summary>
        /// 获取值信息
        /// </summary>
        public override object[] GetValues()
        {
            return new object[] {
				this._GroupID,
				this._GroupName,
				this._GroupDes,
				this._IsDelete,
				this._CreateUser,
				this._CreateDate};
        }
        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        public override void SetPropertyValues(IDataReader reader)
        {
            this._GroupID = DataUtils.ConvertValue<string>(reader["GroupID"]);
            this._GroupName = DataUtils.ConvertValue<string>(reader["GroupName"]);
            this._GroupDes = DataUtils.ConvertValue<string>(reader["GroupDes"]);
            this._IsDelete = DataUtils.ConvertValue<bool?>(reader["IsDelete"]);
            this._CreateUser = DataUtils.ConvertValue<string>(reader["CreateUser"]);
            this._CreateDate = DataUtils.ConvertValue<DateTime?>(reader["CreateDate"]);
        }
        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        public override void SetPropertyValues(DataRow row)
        {
            this._GroupID = DataUtils.ConvertValue<string>(row["GroupID"]);
            this._GroupName = DataUtils.ConvertValue<string>(row["GroupName"]);
            this._GroupDes = DataUtils.ConvertValue<string>(row["GroupDes"]);
            this._IsDelete = DataUtils.ConvertValue<bool?>(row["IsDelete"]);
            this._CreateUser = DataUtils.ConvertValue<string>(row["CreateUser"]);
            this._CreateDate = DataUtils.ConvertValue<DateTime?>(row["CreateDate"]);
        }
        #endregion

        #region _Field
        /// <summary>
        /// 字段信息
        /// </summary>
        public class _
        {
            /// <summary>
            /// * 
            /// </summary>
            public readonly static Field All = new Field("*", "Sys_Group");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field GroupID = new Field("GroupID", "Sys_Group", "GroupID");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field GroupName = new Field("GroupName", "Sys_Group", "GroupName");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field GroupDes = new Field("GroupDes", "Sys_Group", "GroupDes");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field IsDelete = new Field("IsDelete", "Sys_Group", "IsDelete");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field CreateUser = new Field("CreateUser", "Sys_Group", "CreateUser");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field CreateDate = new Field("CreateDate", "Sys_Group", "CreateDate");
        }
        #endregion


    }
}

